home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / C Internet Config / IC Application Source ƒ / 68k Internet Config ƒ / IC Universals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-01  |  7.7 KB  |  192 lines  |  [TEXT/SPM ]

  1. /*
  2.     IC Universals.h
  3.     
  4.     See IC Universals.c for the comment.
  5. */
  6.  
  7. #pragma once
  8.  
  9. #ifndef __H_IC_Universals__
  10. #define __H_IC_Universals__
  11.  
  12. typedef OSErr (*ApplicationProcPtr)(void);
  13. typedef OSErr (*DocumentProcPtr)(FSSpec* spec);
  14. typedef OSErr (*WindowPlainProcPtr)(WindowType wt,short item);
  15. typedef OSErr (*WindowEventProcPtr)(WindowType wt,short item,EventRecord* er);
  16. typedef OSErr (*WindowBooleanProcPtr)(WindowType wt,short item,Boolean act);
  17. typedef OSErr (*WindowCursorProcPtr)(WindowType wt,short item,Point where,short cursid);
  18. typedef pascal void (*ListKeyProcPtr)(ListHandle lh,Cell c,StringPtr str);
  19. typedef pascal void (*BeeperProcPtr)(short sound);
  20.  
  21. enum {
  22.     uppApplicationProcInfo=kCStackBased
  23.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr))),
  24.     uppDocumentProcInfo=kCStackBased
  25.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  26.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(FSSpec*))),
  27.     uppWindowPlainProcInfo=kCStackBased
  28.         |RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  29.         |STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WindowType)))
  30.         |STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short))),
  31.     uppWindowEventProcInfo=kCStackBased
  32.         |RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  33.         |STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WindowType)))
  34.         |STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short)))
  35.         |STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(EventRecord*))),
  36.     uppWindowBooleanProcInfo=kCStackBased
  37.         |RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  38.         |STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WindowType)))
  39.         |STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short)))
  40.         |STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Boolean))),
  41.     uppWindowCursorProcInfo=kCStackBased
  42.         |RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  43.         |STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WindowType)))
  44.         |STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short)))
  45.         |STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Point)))
  46.         |STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(short))),
  47.     uppListKeyProcInfo=kPascalStackBased
  48.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(ListHandle)))
  49.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(Cell)))
  50.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(StringPtr))),
  51.     uppBeeperProcInfo=kPascalStackBased
  52.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(short)))
  53. };
  54.  
  55. #if USESROUTINEDESCRIPTORS
  56. typedef UniversalProcPtr ApplicationUPP;
  57. typedef UniversalProcPtr DocumentUPP;
  58. typedef UniversalProcPtr WindowPlainUPP;
  59. typedef UniversalProcPtr WindowEventUPP;
  60. typedef UniversalProcPtr WindowBooleanUPP;
  61. typedef UniversalProcPtr WindowCursorUPP;
  62. typedef UniversalProcPtr ListKeyUPP;
  63. typedef UniversalProcPtr BeeperUPP;
  64.  
  65. #define CallApplicationProc(p) \
  66.     CallUniversalProc((UniversalProcPtr)(p),uppApplicationProcInfo)
  67. #define CallDocumentProc(p,spec) \
  68.     CallUniversalProc((UniversalProcPtr)(p),uppDocumentProcInfo,(spec))
  69. #define CallWindowPlainProc(p,w,i)\
  70.     CallUniversalProc((UniversalProcPtr)(p),uppWindowPlainProcInfo,(w),(i))
  71. #define CallWindowEventProc(p,w,i,e)\
  72.     CallUniversalProc((UniversalProcPtr)(p),uppWindowEventProcInfo,(w),(i),(e))
  73. #define CallWindowBooleanProc(p,w,i,b)\
  74.     CallUniversalProc((UniversalProcPtr)(p),uppWindowBooleanProcInfo,(w),(i),(b))
  75. #define CallWindowCursorProc(p,w,i,t,c)\
  76.     CallUniversalProc((UniversalProcPtr)(p),uppWindowCursorProcInfo,(w),(i),(t),(c))
  77. #define CallListKeyProc(p,l,c,s) \
  78.     CallUniversalProc((UniversalProcPtr)(p),uppListKeyProcInfo,(l),(c),(s))
  79. #define CallBeeperProc(p,n) \
  80.     CallUniversalProc((UniversalProcPtr)(p),uppBeeperProcInfo,(n))
  81.  
  82. #define NewApplicationProc(routine) \
  83.     (ApplicationUPP)NewRoutineDescriptor((ProcPtr)(routine),uppApplicationProcInfo,GetCurrentISA())
  84. #define NewDocumentProc(routine) \
  85.     (DocumentUPP)NewRoutineDescriptor((ProcPtr)(routine),uppDocumentProcInfo,GetCurrentISA())
  86. #define NewWindowPlainProc(routine) \
  87.     (WindowPlainUPP)NewRoutineDescriptor((ProcPtr)(routine),uppWindowPlainProcInfo,GetCurrentISA())
  88. #define NewWindowEventProc(routine) \
  89.     (WindowEventUPP)NewRoutineDescriptor((ProcPtr)(routine),uppWindowEventProcInfo,GetCurrentISA())
  90. #define NewWindowBooleanProc(routine) \
  91.     (WindowBooleanUPP)NewRoutineDescriptor((ProcPtr)(routine),uppWindowBooleanProcInfo,GetCurrentISA())
  92. #define NewWindowCursorProc(routine) \
  93.     (WindowCursorUPP)NewRoutineDescriptor((ProcPtr)(routine),uppWindowCursorProcInfo,GetCurrentISA())
  94. #define NewListKeyProc(routine) \
  95.     (ListKeyUPP)NewRoutineDescriptor((ProcPtr)(routine),uppListKeyProcInfo,GetCurrentISA())
  96. #define NewBeeperProc(routine) \
  97.     (BeeperUPP)NewRoutineDescriptor((ProcPtr)(routine),uppBeeperProcInfo,GetCurrentISA())
  98.  
  99. #define DisposeApplicationProc(routine) \
  100.     DisposeRoutineDescriptor((UniversalProcPtr)(routine))
  101. #define DisposeDocumentProc(routine) \
  102.     DisposeRoutineDescriptor((UniversalProcPtr)(routine))
  103. #define DisposeWindowPlainProc(routine) \
  104.     DisposeRoutineDescriptor((UniversalProcPtr)(routine))
  105. #define DisposeWindowEventProc(routine) \
  106.     DisposeRoutineDescriptor((UniversalProcPtr)(routine))
  107. #define DisposeWindowBooleanProc(routine) \
  108.     DisposeRoutineDescriptor((UniversalProcPtr)(routine))
  109. #define DisposeWindowCursorProc(routine) \
  110.     DisposeRoutineDescriptor((UniversalProcPtr)(routine))
  111. #define DisposeListKeyProc(routine) \
  112.     DisposeRoutineDescriptor((UniversalProcPtr)(routine))
  113. #define DisposeBeeperProc(routine) \
  114.     DisposeRoutineDescriptor((UniversalProcPtr)(routine))
  115.  
  116. #else
  117. typedef ApplicationProcPtr ApplicationUPP;
  118. typedef DocumentProcPtr DocumentUPP;
  119. typedef WindowPlainProcPtr WindowPlainUPP;
  120. typedef WindowEventProcPtr WindowEventUPP;
  121. typedef WindowBooleanProcPtr WindowBooleanUPP;
  122. typedef WindowCursorProcPtr WindowCursorUPP;
  123. typedef ListKeyProcPtr ListKeyUPP;
  124. typedef BeeperProcPtr BeeperUPP;
  125.  
  126. #define CallApplicationProc(p) (*(p))()
  127. #define CallDocumentProc(p,spec) (*(p))(spec)
  128. #define CallWindowPlainProc(p,w,i) (*(p))((w),(i))
  129. #define CallWindowEventProc(p,w,i,e) (*(p))((w),(i),(e))
  130. #define CallWindowBooleanProc(p,w,i,b) (*(p))((w),(i),(b))
  131. #define CallWindowCursorProc(p,w,i,t,c) (*(p))((w),(i),(t),(c))
  132. #define CallListKeyProc(p,l,c,s) (*(p))((l),(c),(s))
  133. #define CallBeeperProc(p,n) (*(p))(n)
  134.  
  135. #define NewApplicationProc(routine) (ApplicationUPP)(routine)
  136. #define NewDocumentProc(routine) (DocumentUPP)(routine)
  137. #define NewWindowPlainProc(routine) (WindowPlainUPP)(routine)
  138. #define NewWindowEventProc(routine) (WindowEventUPP)(routine)
  139. #define NewWindowBooleanProc(routine) (WindowBooleanUPP)(routine)
  140. #define NewWindowCursorProc(routine) (WindowCursorUPP)(routine)
  141. #define NewListKeyProc(routine) (ListKeyUPP)(routine)
  142. #define NewBeeperProc(routine) (BeeperUPP)(routine)
  143.  
  144. #define DisposeApplicationProc(routine)
  145. #define DisposeDocumentProc(routine)
  146. #define DisposeWindowPlainProc(routine)
  147. #define DisposeWindowEventProc(routine)
  148. #define DisposeWindowBooleanProc(routine)
  149. #define DisposeWindowCursorProc(routine)
  150. #define DisposeListKeyProc(routine)
  151. #define DisposeBeeperProc(routine)
  152.  
  153. #endif
  154.  
  155. // External Global Declarations
  156. extern DlgHookUPP gButtonHookUPP;        
  157. extern ModalFilterUPP gAskServerFilter;        
  158. extern UserItemUPP gDisplayFontProc;
  159. extern ModalFilterUPP gMyModalFilter;    
  160. extern AEEventHandlerUPP gHandleEditPrefAE;
  161. extern DeviceLoopDrawingUPP gButtonDeviceLoopProc;
  162. extern UserItemUPP gButtonUserItemUpdate;
  163. extern FileFilterYDUPP gMyCustomGetDirectoryFileFilter;
  164. extern DlgHookYDUPP gMyCustomGetDirectoryDlogHook;
  165. extern UserItemUPP gDrawTextProc;
  166. extern ModalFilterUPP gCancelModalFilter;
  167. extern UserItemUPP gHelperUserItemUpdate;
  168. extern ListDefUPP gHelperLDEF;
  169. extern ModalFilterUPP gDoAddFilter;
  170. extern ListKeyUPP gGetHelpEntryName;
  171. extern ListKeyUPP gGetFileMapEntryName;
  172. extern ModalFilterUPP gCancelDiscardModalFilter;
  173. extern UserItemUPP gFileMapUserItemUpdate;
  174. extern ListDefUPP gFileListLDEF;
  175. extern ModalFilterUPP gOKModalFilter;
  176. extern ModalFilterUPP gAddChangeFilter;
  177. extern UserItemUPP gOutlineDefault1;
  178.  
  179. #ifdef __cplusplus
  180. extern "C" {
  181. #endif
  182.  
  183. void InitUniversals(void);
  184.  
  185. #ifdef __cplusplus
  186. }
  187. #endif
  188.  
  189. #endif /* __H_IC_Universals__ */
  190.  
  191.  
  192.